package com.hup.minicontroller.client.view.main;

import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;

/**
 * 连接中的dialog
 *
 * @author hugan
 * @date 2021/5/23
 */
public class ConnectingDialog extends JDialog {

    private JLabel labMsg;

    private ConnectingDialog(Window owner) {
        //super(owner, ModalityType.APPLICATION_MODAL);
        //setModal(true);
        //super(owner, ModalityType.DOCUMENT_MODAL);
        super(owner);
        setModal(true);
        setUndecorated(true);
        labMsg = new JLabel();
        JPanel panel = new JPanel();
        panel.setBorder(new LineBorder(Color.BLACK, 2));
        panel.add(labMsg);
        add(panel);
    }

    public static ConnectingDialog create(Window owner, String msg) {
        ConnectingDialog dialog = new ConnectingDialog(owner);
        dialog.labMsg.setText(msg);
        dialog.pack();
        dialog.setLocationRelativeTo(owner);
        return dialog;
    }

}
